package org.gd.hellojavacore.lightsoft;

/**
 * @author Gorhover
 */
public class BracesChecker {

    private static final char BRACKET1_OPEN = '{';
    private static final char BRACKET1_CLOSE = '}';
    private static final char BRACKET2_OPEN = '(';
    private static final char BRACKET2_CLOSE = ')';

    public static boolean isCorrect(String str) {
        if(str == null) {
            throw new NullPointerException();
        }
        return str.isEmpty() || rec(str);
    }

    private static boolean rec(String str) {
        return rec(str.toCharArray());
    }

    private static boolean rec(char[] chars) {
        char current = ' ';
        for(char c: chars) {
            if(c == ' ') {
                continue;
            }

            System.out.print(c);
        }
        return false;
    }

    private static boolean isOpenBracket(char c) {
        return c==BRACKET1_OPEN || c==BRACKET2_OPEN;
    }

    private static boolean isCloseBracket(char c) {
        return c==BRACKET1_CLOSE || c==BRACKET2_CLOSE;
    }
}
